function Animal (name, age) {
  this.name = name;
  this.age = age;
  Animal.prototype.sayName = function () {
    console.log('my name is', this.name);
  };
  Animal.prototype.sayAge = function () {
    console.log(this.age);
  }
}

function Person (name, age, gender) {
  // 
  Animal.call(this, name, age)
  this.gender = gender;
}
Person.prototype = new Animal()
Person.prototype.constructor = Person
Person.prototype.sayGender = function () {
  console.log('my gender is', this.gender);
}
var p1 = new Person('zhangsan', 12, 'male')
console.log(p1);
p1.sayGender()
p1.sayName()
console.log(p1 instanceof Person);
console.log(p1 instanceof Animal);
console.log(p1 instanceof Object);